import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 导入全局样式
import './assets/css/global.css'
//引入阿里图标
import './assets/fonts/iconfont.css'
// 全局导入ele-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
// 导入
import treeTable from 'vue-table-with-tree-grid'
Vue.component('tree-table', treeTable)

// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'

// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueQuillEditor)

// 导入进度条nprogress
import NProgress from 'nprogress' // 引入nprogress插件
import 'nprogress/nprogress.css'  // 这个nprogress样式必须引入


// 配置axios
import axios from 'axios'
// 通过请求拦截器添加token
// 在request拦截器中显示进度条
axios.interceptors.request.use(config => {
	NProgress.start() // 设置加载进度条(开始..)
	console.log(config)
	config.headers.Authorization = window.sessionStorage.getItem('token');
	// 在最后必须return config
	return config
})
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
Vue.prototype.$http = axios

// 在response拦截器中隐藏进度条
axios.interceptors.response.use(config => {
	NProgress.done() // 设置加载进度条(结束..)
	return config
})

Vue.config.productionTip = false

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
